package com.topisv.tms.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.topisv.tms.entity.BackupTaskSku;

public interface BackupTaskSkuDao extends JpaSpecificationExecutor<BackupTaskSku>,
		PagingAndSortingRepository<BackupTaskSku, Long> {
	
	/**
	 * 根据拣货任务编号与拣货状态查询
	 * @param backupTaskCode
	 * @param pickStatus
	 * @return
	 */
	List<BackupTaskSku> findByBackupTaskCodeAndPickStatus(String backupTaskCode,String pickStatus);

	/**
	 * 根据备货编号与商品编号查询商品信息
	 * @param backupTaskCode
	 * @param skuId
	 * @return
	 */
	BackupTaskSku findByBackupTaskCodeAndSkuId(String backupTaskCode,String skuId);
	@Query("select b from BackupTaskSku b where b.backupTaskCode=? order by b.stockLists")
	List<BackupTaskSku> findByBackupTaskCode(String backupTaskCode);
	
	List<BackupTaskSku> findByBackupTaskCodeAndStatus(String backupTaskCode,String status);
	
	/**
	 * 根据备货批次号查询
	 * @param batchTaskCode
	 * @return
	 */
	List<BackupTaskSku> findByBatchTaskCode(String batchTaskCode);
	
	
	/**
	 * 根据拣货任务编号与批次任务编号查询
	 * @param backupTaskCode
	 * @param batchTaskCode
	 * @return
	 */
	List<BackupTaskSku> findByBackupTaskCodeAndBatchTaskCode(String backupTaskCode,String batchTaskCode);
}
